function f_add_promotionsDay(editName, editValue) {
    var row = GRID.getSelectedRow();
    if (editName != "food_code") {
//        var num = null == row.food_number ? 0 : row.food_number;
//        var pri = null == row.food_price ? 0 : row.food_price;
//        var xx = (num * 10000 * pri) / 10000;
//        GRID.updateCell("food_priceSum", xx, row);
        return;
    } else if (editName == "food_code" && (null == editValue || editValue.trim().length == 0)) {
        f_comboxB_setFoodValue();
        f_comboxB_setUnitValue();
        return;
    } else {
        var foodData = myajax("weixinkeji/dev/dc/base/food/s/one.imy", {"food_code": editValue});
        if (null == foodData.unit_id) {
            f_comboxB_setFoodValue();
            f_comboxB_setUnitValue();
            return;
        }
        var unitData = myajax("weixinkeji/dev/dc/base/unit/s/one.imy", {"unit_id": foodData.unit_id});
        f_comboxB_setFoodValue(foodData);
        f_comboxB_setUnitValue(unitData);
    }
    function f_comboxB_setFoodValue(data) {
        GRID.updateCell("food_id", null == data ? "" : f_formatMyValue(data.food_id), row);
        GRID.updateCell("food_name", null == data ? "" : f_formatMyValue(data.food_name), row);
        GRID.updateCell("food_code", null == data ? "" : f_formatMyValue(data.food_code), row);
        GRID.updateCell("food_img", null == data ? "" : f_formatMyValue(data.food_img), row);
        GRID.updateCell("food_price", null == data ? "" : f_formatMyValue(data.food_price), row);
        GRID.updateCell("food_number", null == data ? "1" : f_formatMyValue(f_formatFood_number(row.food_number)), row);
//        GRID.updateCell("food_priceSum", null == data ? "" : (row.food_number * 10000 * data.food_price) / 10000, row);
    }
    function f_comboxB_setUnitValue(data) {
        GRID.updateCell("unit_id", null == data ? "" : f_formatMyValue(data.unit_id), row);
        GRID.updateCell("unit_name", null == data ? "" : f_formatMyValue(data.unit_name), row);
    }
    function f_formatMyValue(v) {
        return null == v ? "" : v;
    }
    function f_formatFood_number(v) {
        return null == v || v == 0 || v.length == 0 ? 1 : v;
    }
}

function f_dc_base_promotionsDay(divId, mydata, f_onClick) {
    var tree = $("#" + divId).ligerTree({
        data: mydata
        , checkbox: false
        , textFieldName: "text"
        , idFieldName: "id"
        , parentIDFieldName: "pid"
        , onClick: f_onClick
    });
    return tree;
}